package com.dsp.inventory.rest;

import com.dsp.inventory.dto.InventoryDTO;
import com.dsp.inventory.service.InventoryService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class InventoryController {

    @Resource
    private InventoryService inventoryService;

    @GetMapping("/all")
    public Object list() {
        return inventoryService.findAll();
    }

    @PostMapping("/test")
    public String test() {
        return "test";
    }

    @PostMapping("/decrease")
    public Boolean decrease(@RequestBody InventoryDTO inventoryDTO) {
        return inventoryService.decrease(inventoryDTO);
    }

    @PostMapping("/decreaseException")
    public Boolean decreaseException(@RequestBody InventoryDTO inventoryDTO) {
        return inventoryService.decreaseException(inventoryDTO);
    }

}